package matlap.client.view.teacher;

import matlap.client.view.MatlapGWT;
import matlap.client.view.admin.StudentsScoreComposite;
import matlap.client.view.admin.TasksComposite;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.MenuItemSeparator;

public class TeacherMenuComposite extends Composite {

	private MenuItem mntmFel;
	private MenuItem mntmEred;
	private MenuItem mntmAdataim;
	private MatlapGWT matlap;
	private Panel bigPanel;
	private String who;

	public TeacherMenuComposite(Panel bP, String w, MatlapGWT matlapGWT) {
		bigPanel = bP;
		who = w;
		matlap = matlapGWT;
		final VerticalPanel verticalPanel = new VerticalPanel();
		initWidget(verticalPanel);
		verticalPanel.setSize("151px", "94px");

		MenuBar menuBar_1 = new MenuBar(true);
		menuBar_1.setStyleName("MenuBar2");
		verticalPanel.add(menuBar_1);
		menuBar_1.setSize("151px", "108px");

		mntmFel = new MenuItem("Beérkezett feladatok", false, new Command() {
			public void execute() {
				bigPanel.clear();
				new TasksComposite(who,bigPanel);
				mntmFel.setStyleName("SelectedMenuItem2");
				mntmEred.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				matlap.setUnSelectedMenuItem();
			}
		});
		mntmFel.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmFel);
		mntmFel.setSize("151", "44");

		MenuItemSeparator separator = new MenuItemSeparator();
		separator.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator);
		separator.setSize("151", "2");

		mntmEred = new MenuItem("Eredmények", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new StudentsScoreComposite());
				mntmFel.setStyleName("MenuItem2");
				mntmEred.setStyleName("SelectedMenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				matlap.setUnSelectedMenuItem();
			}
		});
		mntmEred.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmEred);
		mntmEred.setSize("151", "23");

		MenuItemSeparator separator1 = new MenuItemSeparator();
		separator1.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator1);
		separator1.setSize("151", "2");

		mntmAdataim = new MenuItem("Adataim", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new TeacherAccountComposite(who));
				mntmFel.setStyleName("MenuItem2");
				mntmEred.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("SelectedMenuItem2");
				matlap.setUnSelectedMenuItem();
			}
		});
		mntmAdataim.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmAdataim);

	}

	public void setUnSelectedMenuItems() {
		mntmFel.setStyleName("MenuItem2");
		mntmEred.setStyleName("MenuItem2");
		mntmAdataim.setStyleName("MenuItem2");

	}

}
